#ifndef MSDENC_H
#define MSDENC_H
//单位秒
#define TIMEOUT_TOKEN_LOGIN			(3*60)	
#define TIMEOUT_TOKEN_WEB			(10*60)
#define TIMEOUT_TOKEN_SDKAPI		(1*60)
#define TIMEOUT_TOKEN_LIVE			(60*60)

typedef enum DECSTRRet{
	decstr_ret_errToken1	=-0x13,
	decstr_ret_noToken		=-0x12,
	decstr_ret_checkFailed	=-0x11,
	decstr_ret_timeout		=-0x10,
	decstr_ret_innerErr		=-0x01,
	decstr_ret_ok			=0x00,
	decstr_ret_super		=0x01,
}DECSTRRet;

#ifndef MSDENC_C

/*****************************************************************************
加密解密
*****************************************************************************/
//数据根据秘钥进行加密或解密
extern ms_u32 
	msdenc_api_encDec_simple(ms_byte* ms_in data, ms_u32 ms_in len,ms_byte * ms_in key,ms_s08 ms_in keylen,
		ms_byte * ms_out outbuf,ms_in ms_bool flag_enc) ;
//根据时间戳和秘钥生成加密字符串，并且可在字符串前（prefmt）和后（aftfmt）添加自定义字符串
extern ms_void 
	msdenc_api_encStr(ms_string     outstr,ms_string pbasekey,ms_string context,ms_string prefmt,ms_string aftfmt);
extern ms_void 
	msdenc_api_encStr2(ms_string     outstr,ms_string pbasekey,ms_string context,ms_string moduleName,ms_string extStr);
//对加密字符串进行验证，包括解密验证和超时
extern DECSTRRet 
	msdenc_api_decStr(ms_string token,ms_string ms_in pbasekey,ms_string context,ms_bool flag_mustdecrypt,ms_u64 timeou_sec);
#endif
#endif
